package com.leyou.test1.demo;

import com.leyou.test1.constants.DateTurnUtils;
import org.junit.Test;

import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;

/**
 * @author : LiuDong
 * @date : Created in 2018/11/26 17:15
 */
public class DateUTCDemoTest {

    /**
     * 功能描述: 测试, 获取日期字符串
     */
    @Test
    public void testGetDateStr() {
        Date date = new Date();
        Calendar calendar = Calendar.getInstance();
        Timestamp ts = new Timestamp(System.currentTimeMillis());

        String dateStrA = DateUTCDemo.getDateStr(ts);
        System.out.println(dateStrA);
        String dateStrB = DateUTCDemo.getDateStr(date);
        System.out.println(dateStrB);
        String dateStrC = DateUTCDemo.getDateStr(calendar.getTimeInMillis());
        System.out.println(dateStrC);
    }
    /**
     * 功能描述: 测试, 获取UTC格式日期字符串
     */
    @Test
    public void testGetUtcDateStr() {
        Date date = new Date();
        Calendar calendar = Calendar.getInstance();
        Timestamp ts = new Timestamp(System.currentTimeMillis());

        String dateStrA = DateUTCDemo.getUtcDateStr(ts);
        System.out.println(dateStrA);
        String dateStrB = DateUTCDemo.getUtcDateStr(date);
        System.out.println(dateStrB);
        String dateStrC = DateUTCDemo.getUtcDateStr(calendar);
        System.out.println(dateStrC);
        String dateStrD = DateUTCDemo.getUtcDateStr(calendar.getTimeInMillis());
        System.out.println(dateStrD);
    }

    /**
     * 功能描述: 测试, 获取当前时间
     */
    @Test
    public void testGetCurryDateStr() {
        DateUTCDemo.getCurryDateStr();
    }
    /**
     * 功能描述: 测试, 获取当前时间
     */
    @Test
    public void testGetCurryDateString() {
        DateUTCDemo.getCurryDateString(DateTurnUtils.PATTERN_MIL);
    }
}
